<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>风味-快递状态</title>
		<link rel="stylesheet" type="text/css" href="css/personCenterPublic.css"/>
		<link rel="stylesheet" type="text/css" href="css/expressStatus.css"/>
		<script src="js/jquery-2.1.0.js"></script>
	</head>
	<body>
			<div id="back">
			<a href="#" onClick="javascript :history.back(-1);"><&nbsp;返回我的快递</a>
		</div>
		<div id="left">
		<img src="img/maodian.png"/>
		</div>
		<!--这里面的img随着下面订单状态有choose的属性改变-->
		<div id="right">
			<ul>
				<li id="finish">交易完成</li>
				<li id="car">运送中
				<br /><span>请耐心等待</span>
				</li>
				<li id="sellers">卖家接单</li>
				<li id="born">订单产生
				<br /><span>时刻关注快递状态哦~</span>
				</li>
			</ul>
		</div>
		<script type="text/javascript">

			function getUrl(){
				var str = location.href;//获取传过来的地址
				var arr = str.split("?");
				var str1 = arr[1];//获取？之后的内容
				var id = str1.split("=")[1];
				return id;
			}

			var left=document.getElementById('left');
			var leftimg=left.getElementsByTagName('img')[0];
			var right=document.getElementById('right');
			var finish=document.getElementById('finish');
			var car=document.getElementById('car');
			var sellers=document.getElementById('sellers');
			var born=document.getElementById('born');

			$.ajax("/fengwei/express/showExpressStatus",{
				type:"get",
				data:{
					'goodsorderId':getUrl()
				},
				success:function(data){
					var dataObj = eval('('+data+')');
					console.log(dataObj);
					setData(dataObj);
				},
				error:function(){
					console.log(0);
				}
			});

			function setData(dataObj){

				var goodsorderStatus = dataObj.goodsorderStatus;
				if(goodsorderStatus == 0){
					$('#born').addClass('choose');
				} else if(goodsorderStatus == 1){
					$('#born').addClass('choose');
					$('#sellers').addClass('choose');
				} else if(goodsorderStatus == 2){
					$('#born').addClass('choose');
					$('#sellers').addClass('choose');
					$('#car').addClass('choose');
				} else if(goodsorderStatus == 3){
					$('#born').addClass('choose');
					$('#sellers').addClass('choose');
					$('#car').addClass('choose');
					$('#finish').addClass('choose');
				}

				if(finish.className=='choose'){
					leftimg.setAttribute('src','img/maodianchoose3.png');
				}else if(car.className=='choose'){
					leftimg.setAttribute('src','img/maodianchoose2.png');
				}else if(sellers.className=='choose'){
					leftimg.setAttribute('src','img/maodianchoose1.png');
				}
			}
			

		</script>
	</body>
</html>
